PATHMac OS 8 and 9 Developer Documentation > Interapplication Communication > AppleScript for Scripters >

AppleScript Language Guide

   

Identifiers

An identifier is a series of characters that identifies a value or other language element. For example, variable names are identifiers. The following statement sets the value of the variable myName to "Fred" .

set myName to "Fred"

Identifiers are also used as labels for properties and handlers. You'll learn about these uses later in this guide.

An identifier must begin with a letter and can contain uppercase letters, lowercase letters, numerals (0-9), and the underscore character (_). Here are some examples of valid identifiers:

Yes
Agent99
Just_Do_It

The following are not valid identifiers:

C--
Back&Forth
999
Why^Not

Identifiers whose first and last characters are vertical bars ( | ) can contain any characters. For example, the following are legal identifiers:

|Back and Forth|
|Right*Now!|

Identifiers whose first and last characters are vertical bars can contain additional vertical bars if the vertical bars are preceded by backslash (\) characters, as in the identifier |This\|Or\|That| . A backslash character in an identifier must be preceded by a backslash character, as in the identifier |/\\ Up \\/ Down |.

AppleScript identifiers are not case sensitive. For example, the variable identifiers myvariable and MyVariable are equivalent.

Identifiers cannot be the same as any reserved words--that is, words in the AppleScript language or words in the dictionary of an application named in a Tell statement. For example, you cannot create a variable whose identifier is file within a Tell statement to the Finder, because file is an object class in the Finder dictionary. In this case, AppleScript returns a syntax error if you use file as a variable identifier.


© 1999 Apple Computer, Inc. – (Last Updated 21 May 99)